home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / ifl / iflError.z / iflError
Encoding:
Text File  |  2002-10-03  |  8.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4. iiiiffffllllEEEErrrrrrrroooorrrr((((3333))))       IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll        iiiiffffllllEEEErrrrrrrroooorrrr((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiiffffllllEEEErrrrrrrroooorrrr,,,, iiiiffffllllEEEErrrrrrrroooorrrrVVVV,,,, iiiiffffllllGGGGeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr,,,, iiiiffffllllSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr,,,,
  10.      iiiiffffllllSSSSttttaaaattttuuuussssTTTTooooSSSSttttrrrriiiinnnngggg,,,, iiiiffffllllMMMMaaaaiiiinnnnSSSSttttaaaattttuuuussssTTTTooooSSSSttttrrrriiiinnnngggg,,,, iiiiffffllllSSSSttttaaaattttuuuussssEEEEnnnnccccooooddddeeee - error
  11.      handling
  12.  
  13. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.      #include <ifl/iflError.h>
  15.  
  16.      void iflError(int flags, const char* fmt, ...)
  17.      void iflErrorV(int flags, const char* fmt, va_list ap)
  18.  
  19.      void iflGetErrorHandler(iflErrorHandlerType* handler, void** arg)
  20.      void iflSetErrorHandler(iflErrorHandlerType newhandler, void* newarg)
  21.  
  22.      char* iflStatusToString(iflStatus status, char buf[], int bufsize)
  23.      const char* iflMainStatusToString(iflMainStatus status)
  24.      iflStatusEncode(unsigned int mainstatus,
  25.                      unsigned int subDomain = iflSubDomainNONE,
  26.                      unsigned int subStatus = 0)
  27.  
  28.  
  29. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  30.      These functions are used to report errors and control how those errors
  31.      are handled in the IFL environment.  These facilities can also be used to
  32.      generate debugging messages.  The routines are grouped into three
  33.      functional areas: error reporting, error handling, and status code
  34.      translation.
  35.  
  36.    EEEErrrrrrrroooorrrr RRRReeeeppppoooorrrrttttiiiinnnngggg
  37.      Error messages can be generated with the iiiiffffllllEEEErrrrrrrroooorrrr() routine. The _f_l_a_g_s
  38.      parameter can have one of the following values:
  39.  
  40.      MM_INFO        informational message, many error handlers will just
  41.                     ignore the message; this is primarily intended for
  42.                     debugging messages
  43.  
  44.      MM_WARNING     warning, most error handlers will return and allow the
  45.                     program to continue executing
  46.  
  47.      MM_ERROR       error, some error handlers will abort (the default error
  48.                     handler will)
  49.  
  50.      MM_HALT        fatal error, most error handlers will abort the program
  51.  
  52.      The _f_m_t parameter is treated as a pppprrrriiiinnnnttttffff() format string. The remaining
  53.      parameters (if any) are used in the formatting process as dictated by the
  54.      format string.
  55.  
  56.      The iiiiffffllllEEEErrrrrrrroooorrrrVVVV() routine is provided for situations where the variable
  57.      arguments have already been packaged in the "va_list" argument, _a_p. See
  58.      the stdarg(5) man page for more details on this mechanism.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiiffffllllEEEErrrrrrrroooorrrr((((3333))))       IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll        iiiiffffllllEEEErrrrrrrroooorrrr((((3333))))
  71.  
  72.  
  73.  
  74.    HHHHaaaannnnddddlllliiiinnnngggg EEEErrrrrrrroooorrrrssss
  75.      The handling of errors is controlled by iiiiffffllllSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr(). The error
  76.      handler is specified by the _n_e_w_h_a_n_d_l_e_r parameter and will be passed the
  77.      _n_e_w_a_r_g parameter as a user closure.  The prototype for an error handling
  78.      routine that could be passed as _n_e_w_h_a_n_d_l_e_r is:
  79.  
  80.           handler(void* closureArg, int flags, const char* fmt, va_list ap)
  81.  
  82.      where the _c_l_o_s_u_r_e_A_r_g corresponds to the _n_e_w_a_r_g parameter of
  83.      iiiiffffllllSSSSeeeettttEEEErrrrrrrroooorrrrHHHHaaaannnnddddlllleeeerrrr() and the _f_l_a_g_s, _f_m_t and _a_p parameters are as
  84.      described for _i_f_l_E_r_r_o_r_V().
  85.  
  86.      It is up to the error handler to decide whether or not to output a
  87.      message and whether or not to abort based on the value of _f_l_a_g_s.
  88.  
  89.      The user may choose to supply their own error handler or use one of three
  90.      built-in error handlers supplied with IL:
  91.  
  92.      iflNaiveErrorHandler    this handler will abort on errors or fatal
  93.                              errors, it ignores informational messages; this
  94.                              is the default handler
  95.  
  96.      iflRobustErrorHandler   this handler will only abort on fatal errors, it
  97.                              ignores informational messages
  98.  
  99.      iflSilentErrorHandler   this handler will ignore all but fatal errors,
  100.                              which will be printed and cause the program to
  101.                              exit.
  102.  
  103.    TTTTrrrraaaannnnssssllllaaaattttiiiinnnngggg EEEErrrrrrrroooorrrr SSSSttttaaaattttuuuussss CCCCooooddddeeeessss
  104.      Errors are encoded via the iflStatus type.  There are three components of
  105.      an iflStatus code:
  106.  
  107.           unsigned int mainstatus:12    IFL status code
  108.  
  109.           unsigned int subDomain:4      domain of subStatus
  110.  
  111.           unsigned int subStatus:16     subdomain status code
  112.  
  113.      _m_a_i_n_s_t_a_t_u_s encodes a main status code; _s_u_b_S_t_a_t_u_s encodes an elaboration
  114.      of the main status code from another domain. For example: _m_a_i_n_s_t_a_t_u_s
  115.      might be iflOPENFAILED and _s_u_b_S_t_a_t_u_s might be ENOFILE to indicate why IL
  116.      returned iflOPENFAILED. In order to determine what _s_u_b_S_t_a_t_u_s means one
  117.      must examine _s_u_b_d_o_m_a_i_n to see whether _s_u_b_S_t_a_t_u_s contains UNIX errno's,
  118.      etc.
  119.  
  120.      The completely 0 status code, iflOKAY, is reserved.  This makes it easier
  121.      for most cases in which the caller does not care about the specific
  122.      value, but only wants to compare with iflOKAY.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiiffffllllEEEErrrrrrrroooorrrr((((3333))))       IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll        iiiiffffllllEEEErrrrrrrroooorrrr((((3333))))
  137.  
  138.  
  139.  
  140.      These fields of the iflStatus type can be picked apart with the
  141.      iiiiffffllllGGGGeeeettttMMMMaaaaiiiinnnnSSSSttttaaaattttuuuussss(), iiiiffffllllGGGGeeeettttSSSSuuuubbbbDDDDoooommmmaaaaiiiinnnn() and iiiiffffllllGGGGeeeettttSSSSuuuubbbbSSSSttttaaaattttuuuussss() macros
  142.      defined in <ifl/iflError.h>.
  143.  
  144.      The iflMainStatus enumerated type used for IL generated errors can be
  145.      translated to a string using the iiiiffffllllMMMMaaaaiiiinnnnSSSSttttaaaattttuuuussssTTTTooooSSSSttttrrrriiiinnnngggg() routine.
  146.  
  147.      An encoded iflStatus value can be converted to a string using
  148.      iiiiffffllllSSSSttttaaaattttuuuussssTTTTooooSSSSttttrrrriiiinnnngggg().  The message will be converted into the user's
  149.      buffer, _b_u_f, and truncated to _b_u_f_s_i_z_e characters in length if necessary.
  150.  
  151.      An iflMainStatus with optional sub-domain and sub-status is encoded into
  152.      an iflStatus value by using the iiiiffffllllSSSSttttaaaattttuuuussssEEEEnnnnccccooooddddeeee() function.
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.